<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%-- 页面标题栏 --%>
<div class="title">
	<s:label cssClass="current fl" key="manager.foodList.title" />
	<s:a href="/manager/home.html" cssClass="back fr">
		[<s:text name="common.button.back" />]
	</s:a>
	<s:a action="foodCopy" cssClass="back pr5 fr">
		[<s:text name="manager.foodCopy.title" />]
	</s:a>
	<span class="back pr5 fr">
		[<s:text name="manager.foodList.title" />]
	</span>
	<div class="clear"></div>
	<hr class="title" />
</div>

<%-- 页面信息 --%>
<div class="clear titleMessage">
	<s:actionmessage cssClass="fl" />
	<s:actionerror cssClass="fl" />
</div>

<%-- 页面体 --%>
<div class="clear body p10">
	<s:form action="/manager/foodList.html" cssClass="fr p0 m0" method="post" theme="simple">
		<s:if test="restBean.langId1 != null && restBean.langId1 != 0">
			<s:label key="manager.foodList.foodName" cssClass="tar" cssStyle="color: black;" />
			(<s:property value="labelLang1" />):
			<s:textfield name="foodName1" cssClass="sti" />
		</s:if>
		<s:if test="restBean.langId2 != null && restBean.langId2 != 0">
			<s:label key="manager.foodList.foodName" cssClass="tar" cssStyle="color: black;" />
			(<s:property value="labelLang2" />):
			<s:textfield name="foodName2" cssClass="sti" />
		</s:if>
		<s:if test="restBean.langId3 != null && restBean.langId3 != 0">
			<s:label key="manager.foodList.foodName" cssClass="tar" cssStyle="color: black;" />
			(<s:property value="labelLang3" />):
			<s:textfield name="foodName3" cssClass="sti" />
		</s:if>
		<s:if test="restBean.langId4 != null && restBean.langId4 != 0">
			<s:label key="manager.foodList.foodName" cssClass="tar" cssStyle="color: black;" />
			(<s:property value="labelLang4" />):
			<s:textfield name="foodName1" cssClass="sti" />
		</s:if>
		<s:if test="restBean.langId5 != null && restBean.langId5 != 0">
			<s:label key="manager.foodList.foodName" cssClass="tar" cssStyle="color: black;" />
			(<s:property value="labelLang5" />):
			<s:textfield name="foodName5" cssClass="sti" />
		</s:if>
		<s:submit  key="common.button.search" cssClass="smallbtn1 tac plr" />
	</s:form>
	<div class="clear pt8"></div>
	<div class="main">
		<s:iterator value="foodList" var="foodBean" status="status" step="1">
			<div class="w180 ha fl p10">
				<img alt="" src="<s:property value="#foodBean.picturePath" />" class="w180 h180" />
				<ul class="normal">
					<li class="fs14 w180">
						<s:a action="foodEdit.html">
							[<s:text name="common.button.edit" />]
							<s:param name="foodId" value="#foodBean.foodId"></s:param>
						</s:a>
						<s:a action="foodDelete.html">
							[<s:text name="common.button.delete" />]
							<s:param name="foodId" value="#foodBean.foodId"></s:param>
						</s:a>
						<s:if test="pageIndex == 0 && #status.first">
							[<s:text name="common.button.forward" />]
						</s:if>
						<s:else>
							<s:a action="doFoodForward.html">
								[<s:text name="common.button.forward" />]
								<s:param name="foodId" value="#foodBean.foodId"></s:param>
							</s:a>
						</s:else>
						<s:if test="pageIndex == pageCount - 1 && #status.last ">
							[<s:text name="common.button.backward" />]
						</s:if>
						<s:else>
							<s:a action="doFoodBackward.html">
								[<s:text name="common.button.backward" />]
								<s:param name="foodId" value="#foodBean.foodId"></s:param>
							</s:a>
						</s:else>
						<%--
						<s:a action="doFoodFirst.html">
							[<s:text name="common.button.first" />]
							<s:param name="foodId" value="#foodBean.foodId"></s:param>
						</s:a>
						<s:a action="doFoodLast.html">
							[<s:text name="common.button.last" />]
							<s:param name="foodId" value="#foodBean.foodId"></s:param>
						</s:a> 
						--%>
					</li>
					<li class="fs18 cr fw500 w180">
						<s:property value="#foodBean.price" />
					</li>
					<li class="fs14 w180">
						<s:property value="#foodBean.foodName" />
					</li>
					<li class="fs14 w180">
						<s:property value="#foodBean.description" />
					</li>
				</ul>
			</div>
			<s:if test="#status.count % 4 == 0">
				<div class="clear"></div>
			</s:if>
		</s:iterator>
		<div class="clear"></div>

		<%-- 翻页（因为要显示图片，比较特殊，所以没有继承layout） --%>
		<s:if test="pageCount != 0">
			<div class="page w800">
				<ul class="page prl">
					<li class="page">
						<s:if test="pageIndex == 0">
							<span class="disabled"><s:text name="common.button.prevPage" /></span>
						</s:if>
						<s:else>
							<s:a action="%{actionPath}?pageIndex=%{pageIndex - 1}%{paramsUrl}">
								<s:text name="common.button.prevPage" />
							</s:a>
						</s:else>
					</li>
					<s:iterator begin="0" end="pageCount - 1" step="1" status="status">
						<li class="page">
							<s:if test="pageIndex == #status.index">
								<span class="current"><s:property value="#status.index + 1" /></span>
							</s:if>
							<s:else>
								<s:a action="%{actionPath}?pageIndex=%{#status.index}%{paramsUrl}">
									<s:property value="#status.index + 1" />
								</s:a>
							</s:else>
						</li>
					</s:iterator>
					<li class="page">
						<s:if test="pageIndex == pageCount - 1 || pageCount == 0">
							<span class="disabled"><s:text name="common.button.nextPage" /></span>
						</s:if>
						<s:else>
							<s:a action="%{actionPath}?pageIndex=%{pageIndex + 1}%{paramsUrl}">
								<s:text name="common.button.nextPage" />
							</s:a>
						</s:else>
					</li>
				</ul>
				<!-- 取消浮动元素 -->
				<ul class="clear"></ul>
			</div>
		</s:if>
	</div>
	<div class="side">
		<s:form action="doFoodAdd" method="post" theme="simple" enctype="multipart/form-data" cssClass="p0 m0">
			<%-- 图片预览 --%>
			<div class="row">
				<div class="cell-label w80">
					<s:text name="manager.foodList.preview" />:
				</div>
				<div class="cell-label w200 h200">
					<s:if test="foodBean.picturePath != null">
						<img alt="" src="<s:property value="foodBean.picturePath" />" class="w200 h200" />
						<s:hidden name="foodBean.picturePath" />
					</s:if>
					<s:else>
						<div class="w200 h200 tac vac">
							<s:text name="manager.foodList.previewInfo" />
						</div>
					</s:else>
				</div>
			</div>
			<%-- 图片 --%>
			<div class="row">
				<div class="cell-label w80">
					<s:text name="manager.foodList.picture" />:
				</div>
				<div class="cell-label w200">
					<s:file name="foodPicture" cssClass="w136"></s:file>
					<s:submit name="upload" method="upload" key="common.button.upload" cssClass="smallbtn1 w60" />
				</div>
			</div>
			<%-- 字段级错误信息 --%>
			<div class="row">
				<div class="cell-label w80"></div>
				<div class="fieldError w200">
					<s:fielderror fieldName="msg.foodName" />
					<s:fielderror fieldName="msg.pirce" />
					<s:fielderror fieldName="msg.picturePath" />
				</div>
			</div>
			<%-- 菜名 --%>
			<s:if test="restBean.langId1 != null && restBean.langId1 != 0">
				<div class="row">
					<div class="cell-label w80">
						<s:text name="manager.foodList.foodName" />(<s:property value="labelLang1" />):
					</div>
					<div class="cell-label w200">
						<s:textfield name="foodBean.foodName1" cssClass="w200" />
					</div>
				</div>
			</s:if>
			<s:if test="restBean.langId2 != null && restBean.langId2 != 0">
				<div class="row">
					<div class="cell-label w80">
						<s:text name="manager.foodList.foodName" />(<s:property value="labelLang2" />):
					</div>
					<div class="cell-label w200">
						<s:textfield name="foodBean.foodName2" cssClass="w200" />
					</div>
				</div>
			</s:if>
			<s:if test="restBean.langId3 != null && restBean.langId3 != 0">
				<div class="row">
					<div class="cell-label w80">
						<s:text name="manager.foodList.foodName" />(<s:property value="labelLang3" />):
					</div>
					<div class="cell-label w200">
						<s:textfield name="foodBean.foodName3" cssClass="w200" />
					</div>
				</div>
			</s:if>
			<s:if test="restBean.langId4 != null && restBean.langId4 != 0">
				<div class="row">
					<div class="cell-label w80">
						<s:text name="manager.foodList.foodName" />(<s:property value="labelLang4" />):
					</div>
					<div class="cell-label w200">
						<s:textfield name="foodBean.foodName4" cssClass="w200" />
					</div>
				</div>
			</s:if>
			<s:if test="restBean.langId5 != null && restBean.langId5 != 0">
				<div class="row">
					<div class="cell-label w80">
						<s:text name="manager.foodList.foodName" />(<s:property value="labelLang5" />):
					</div>
					<div class="cell-label w200">
						<s:textfield name="foodBean.foodName5" cssClass="w200" />
					</div>
				</div>
			</s:if>
			<%-- 价格 --%>
			<div class="row">
				<div class="cell-label w80">
					<s:text name="manager.foodList.price" />:
				</div>
				<div class="cell-label w200">
					<s:textfield name="priceStr" cssClass="w200" />
				</div>
			</div>
			<%-- 描述 --%>
			<s:if test="restBean.langId1 != null && restBean.langId1 != 0">
				<div class="row">
					<div class="cell-label w80 pt8">
						<s:text name="manager.foodList.description" />(<s:property value="labelLang1" />):
					</div>
					<div class="cell-label w200 pt8">
						<s:textarea name="foodBean.description1" cssClass="w200 h60" />
					</div>
				</div>
			</s:if>
			<s:if test="restBean.langId2 != null && restBean.langId2 != 0">
				<div class="row">
					<div class="cell-label w80 pt8">
						<s:text name="manager.foodList.description" />(<s:property value="labelLang2" />):
					</div>
					<div class="cell-label w200 pt8">
						<s:textarea name="foodBean.description2" cssClass="w200 h60" />
					</div>
				</div>
			</s:if>
			<s:if test="restBean.langId3 != null && restBean.langId3 != 0">
				<div class="row">
					<div class="cell-label w80 pt8">
						<s:text name="manager.foodList.description" />(<s:property value="labelLang3" />):
					</div>
					<div class="cell-label w200 pt8">
						<s:textarea name="foodBean.description3" cssClass="w200 h60" />
					</div>
				</div>
			</s:if>
			<s:if test="restBean.langId4 != null && restBean.langId4 != 0">
				<div class="row">
					<div class="cell-label w80 pt8">
						<s:text name="manager.foodList.description" />(<s:property value="labelLang4" />):
					</div>
					<div class="cell-label w200 pt8">
						<s:textarea name="foodBean.description4" cssClass="w200 h60" />
					</div>
				</div>
			</s:if>
			<s:if test="restBean.langId5 != null && restBean.langId5 != 0">
				<div class="row">
					<div class="cell-label w80 pt8">
						<s:text name="manager.foodList.description" />(<s:property value="labelLang5" />):
					</div>
					<div class="cell-label w200 pt8">
						<s:textarea name="foodBean.description5" cssClass="w200 h60" />
					</div>
				</div>
			</s:if>
			<div class="row">
				<div class="cell-label w80"></div>
				<div class="cell-label w200 p10">
					<s:submit name="save" method="save" key="common.button.save" cssClass="thinbtn3 w200" />
				</div>
			</div>
		</s:form>
	</div>
</div>
<div class="clear"></div>